home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / DELPHI32 / GRAPHICS / TS32 / HIRESTIM.INT < prev    next >
Text File  |  1996-03-21  |  1KB  |  46 lines

  1. unit HiResTimer;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, MMSystem, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
  7.  
  8. type
  9.  
  10.   THiResTimer = class;
  11.   EHiResTimer = class( Exception );
  12.  
  13.   TTimerThread = class( TThread )
  14.   private
  15.   protected
  16.   public
  17.      hr: THiResTimer;
  18.      procedure Execute; override;
  19.   end;
  20.  
  21.   THiResTimer = class( TComponent )
  22.   private
  23.      nID: UINT;
  24.      FEnabled: boolean;
  25.      FInterval: UINT;
  26.      FResolution: UINT;
  27.      FOnTimer: TNotifyEvent;
  28.      hTimerEvent: THandle;
  29.      bPaused: boolean;
  30.      timerThread: TTimerThread;
  31.      procedure CreateTimer;
  32.   protected
  33.      procedure SetEnabled( b: boolean );
  34.   public
  35.      constructor Create( AOwner: TComponent ); override;
  36.      destructor Destroy; override;
  37.      procedure Pause;
  38.      procedure Resume;
  39.   published
  40.      property Enabled: boolean read FEnabled write SetEnabled default FALSE;
  41.      property Interval: UINT read FInterval write FInterval default 100;
  42.      property Resolution: UINT read FResolution write FResolution default 100;
  43.      property OnTimer: TNotifyEvent read FOnTimer write FOnTimer;
  44.   end;
  45.  
  46. procedure Register;